<template>
  <div class="newslist">
    <van-card
      v-for="item in newslist"
      :key="item.id"
      :title="item.title"
      :thumb="item.img_url"
      :thumb-link="'#/home/newsinfo/' + item.id"
    >
      <template #price>
        {{ item.add_time }}
      </template>
      <template #num>
        {{ `阅读${item.click}次` }}
      </template>
    </van-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newslist: [],
    };
  },
  created() {
    this.getNewsList();
  },
  methods: {
    async getNewsList() {
      const res = await this.$http.getNewsList();
      this.newslist = res.data.message;
    },
  },
};
</script>
<style lang="scss" scoped>
.newslist {
  .van-card {
    background-color: #fff;
    .van-card__price {
      color: red;
    }
    .van-card__thumb {
      height: 68px;
    }
    .van-card__content {
      min-height: 68px;
    }
    .van-card__title {
      display: -webkit-box;
      -webkit-line-clamp: 1;
    }
  }
}
</style>
